from django.urls import path, re_path, include
from web.views import account, home, project, statistics, wiki, file, setting, issues,dashboard

urlpatterns = [
    path('register/', account.register, name='register'),
    path('send/sms/', account.send_sms, name='send_sms'),
    path('login/sms/', account.login_sms, name='login_sms'),
    path('login/', account.login, name='login'),
    path('logout/', account.logout, name='logout'),
    path('image/code/', account.image_code, name='image_code'),
    path('index/', home.index, name='index'),

    path('price/', home.price, name='price'),
    re_path(r'^payment/(?P<policy_id>\d+)/$', home.payment, name='payment'),
    path('pay/', home.pay, name='pay'),
    path('pay/notify/', home.pay_notify, name='pay_notify'),

    # 项目
    path('project/list/', project.project_list, name='project_list'),
    re_path(r'^project/star/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_star, name='project_star'),
    re_path(r'^project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_unstar,
            name='project_unstar'),

    # 项目管理
    re_path(r'^manage/(?P<project_id>\d+)/', include([




        path(r'wiki/', wiki.wiki, name='wiki'),
        path(r'wiki/add/', wiki.wiki_add, name='wiki_add'),
        path(r'wiki/catalog/', wiki.wiki_catalog, name='wiki_catalog'),
        re_path(r'wiki/delete/(?P<wiki_id>\d+)/', wiki.wiki_delete, name='wiki_delete'),
        re_path(r'wiki/edit/(?P<wiki_id>\d+)/', wiki.wiki_edit, name='wiki_edit'),
        re_path(r'wiki/upload/', wiki.wiki_upload, name='wiki_upload'),

        path(r'file/', file.file, name='file'),
        path(r'file/delete/', file.file_delete, name='file_delete'),
        path(r'cos/credential/', file.cos_credential, name='cos_credential'),
        path(r'file/post/', file.file_post, name='file_post'),
        re_path(r'file/download/(?P<file_id>\d+)/', file.file_download, name='file_download'),

        path(r'setting/', setting.setting, name='setting'),
        path(r'setting/delete/', setting.setting_delete, name='setting_delete'),

        path(r'issues/', issues.issues, name='issues'),
        re_path(r'issues/detail/(?P<issues_id>\d+)/', issues.issues_detail, name='issues_detail'),
        re_path(r'issues/record/(?P<issues_id>\d+)/', issues.issues_record, name='issues_record'),
        re_path(r'issues/change/(?P<issues_id>\d+)/', issues.issues_change, name='issues_change'),

        re_path(r'invite/url/', issues.invite_url, name='invite_url'),

        path(r'dashboard/', dashboard.dashboard, name='dashboard'),
        path(r'dashboard/issues/chart/', dashboard.issues_chart, name='issues_chart'),

        path(r'statistics/', statistics.statistics, name='statistics'),
        path(r'statistics/priority/', statistics.statistics_priority, name='statistics_priority'),
        path(r'statistics/project/user/', statistics.statistics_project_user, name='statistics_project_user'),
    ], None)),

    re_path(r'invite/join/(?P<code>\w+)/', issues.invite_join, name='invite_join')
]
